package com.zdxlz.fcmp.common.mybatis.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author: aman
 * @date 2025/2/14 17:01
 * @description 任务信息表【任务状态】枚举类
 */
@Getter
@AllArgsConstructor
public enum HandleStatusEnum {
    // 【TS_INSERT】为默认值
    CREATE(1, "新建"),
    PROCESSING(2, "处理中"),
    SUCCESS(3, "成功"),
    FAILED(4, "失败"),
    ;

    @EnumValue
    private final Integer code;
    private final String name;

    public static HandleStatusEnum getByCode(Integer code) {
        for (HandleStatusEnum ticketStatusEnum : HandleStatusEnum.values()) {
            if (ticketStatusEnum.getCode() == code) {
                return ticketStatusEnum;
            }
        }
        return null;
    }

    @JsonValue
    public int getCode() {
        return code;
    }
}
